from django.shortcuts import render
from db.models import User


##简单的登录装饰器判断
def verify(fun):
    def login_verify(request):

        try:
            phone = request.session['phone']
        except:
            return render(request, 'login/login.html')
        else:
            user = User.objects.get(phone=phone)

            return fun(request, user)

    return login_verify
